import { Button, Form } from "antd";
import TextArea from "antd/es/input/TextArea";




export type EditorProps = {
  onChange: (value:string)=>void;
  onSubmit: ()=>void;
  submitting: boolean;
  value: string;
};



const Editor:React.FC<EditorProps> = ({ onChange, onSubmit, submitting, value }) => {

  const onchange = (e)=>{
    onChange(e.target.value);
  }

  return (
    <div>
      <Form.Item>
        <TextArea rows={4} onChange={onchange} value={value} />
      </Form.Item>
      <Form.Item>
        <Button htmlType="submit" loading={submitting} onClick={onSubmit} type="primary">
          评论
        </Button>
      </Form.Item>
    </div>
  );
};
  


export default Editor;